//微信小程序相关
const appid = 'wx34925f2944bb0472'
const secret = 'a7521984cb51004c44b39551dc590248'


module.exports = {
    _before: function () { // 通用预处理器

    },
    // 获取登录用户的openApi
    getOpenId: async function (code) {
        //验证openId地址
        const url = 'https://api.weixin.qq.com/sns/jscode2session'
        const res = await uniCloud.httpclient.request(url, {
            data: {
                appid: appid,
                secret: secret,
                js_code: code,
                grant_type: 'authorization_code'
            },
            dataType: 'json'
        })
        return res.data
    }
}
